! LSQUARE. Add a least-squares line to data points.
! Data taken from "The Shortwave Propagation Handbook" (2nd ed)
! by George Jacobs and Theodore J. Cohen. Page 111.
!
LIBRARY "sglib.trc"
DIM x(120),y(120)
MAT READ x,y
CALL tw_wset_title(0,"lsquare")
CALL SetYscale(70,170)
CALL SetText("Sunspots vs. Solar Flux","Daily Sunspot Number","Daily Solar Flux")
CALL DataGraph(x,y,6,0,"red green yellow")
CALL AddLSgraph(x,y,1,"red")
get point tmp,tmp2
DATA 16,17,5,4,18,19,21,24,22,25,28,30,32,33,31,35,21,25,26,30,28,31,37,37,39,38,34,25,40,41,43,44,42,45,47,48,50,50,52,56,57,59,46,42,41,45,48,52,44,45,49,55,58,59,53,55,55,59,57,65,64,61,63,64,66,65,67,69,71,76,75,81,80,80,81,82,87,90,84,84,64,65,78,78,73,80,77,74,70,70,61,63,73,74,73,77,79,78,79,63,81,94,97,93,93,86,79,98,93,116,116,115,116,104,127,125,130,131,123,139
DATA 81,84,84,88,89,87,90,89,87,87,85,82,91,90,87,85,96,95,95,99,93,94,95,98,96,103,105,111,100,94,99,97,97,94,97,98,100,95,97,102,104,104,104,105,107,109,108,108,112,115,115,115,116,117,120,119,127,125,133,103,106,110,108,111,108,107,108,107,108,105,110,102,107,108,108,106,110,114,118,119,116,115,119,118,116,114,115,114,121,122,126,127,125,128,131,126,127,131,130,133,131,129,131,123,135,138,140,144,146,148,158,157,156,157,154,159,159,163,162,166